<!--{template admin/header}-->
<style type="text/css">
    .tableborder td{height: inherit;}
    .ke-iframe{width:100%;}
</style>
<script type="text/javascript" src="static/js/imgupload.js"></script>
<script type="text/javascript">
    $(function(){
        $('#publisher_files').uploadify({
            'uploader':'{conf site_url}/images/uploadify/uploadify.swf?id=&random=' + Math.random(), 
            'script':'{echo urlencode({conf site_url}."/ajax.php?mod=uploadify&code=uploadimg")}', 
            'cancelImg':'{conf site_url}/images/uploadify/cancel.png', 
            'buttonImg':'{conf site_url}/images/uploadify/upload.gif', 
            'width':58, 
            'height':58, 
            'multi':true, 
            'auto':true, 
            'sizeLimit':'{conf image_size_limit}', 
            'fileExt':'*.jpg;*.png;*.gif;*.jpeg', 
            'fileDesc':'请选择图片文件(*.jpg;*.png;*.gif;*.jpeg)', 
            'queueID':'uploadifyQueueDiv', 
            'wmode':'transparent', 
            'fileDataName':'image', 
            'queueSizeLimit':'1', 
            'simUploadLimit':1, 
            'scriptData':{'cookie_auth':'{echo urlencode(jsg_getcookie("auth"))}'}, 
            'onSelect':function(event, ID, fileObj){}, 
            'onSelectOnce':function(event, data){ }, 
            'onProgress':function(event, ID, fileObj, data){return false; }, 
            'onComplete':function(event, ID, fileObj, response, data){
                eval('var r =' + response + ';'); 
                if (r.done){
                    var rv = r.retval; 
                    if (rv.id > 0 && rv.src.length > 0) {
                        var idval = ('undefined' == typeof (rv.id) ? 0 : rv.id);
                        var srcval = ('undefined' == typeof (rv.src) ? 0 : rv.src);
//                        var imageIdsCount = 0;
//                        $(".upimg_img").each(function() {
//                            imageIdsCount += 1;
//                        });
//                        if (imageIdsCount >= 1) {
//                            MessageBox('warning', '只能上传一张');
//                            return false;
//                        }
                        $('#viewImgDiv').html("<div class='upimg_img' id='upimg_" + idval + "'><input type='hidden' name='topic' value='" + idval + "' /><input type='hidden' name='files' value='" + srcval + "' /><img src='" + srcval + "'/><a href='javascript:void(0);' onclick='imageUploadifyDelete(" + idval + "); return false;' title='删除图片' class='u-del'>X</a></div>");
                        //imageUploadifyComplete('{$h_key}', rv.id, rv.src, fileObj.name); 
                    }
                }
            }, 
            
        }); 
    });
</script>
<script src="static/js/date/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript">
	var textCounter=function (field,counter,maxlimit){
		var charcnt = field.value.length;
		if (charcnt > maxlimit) {
			field.value = field.value.substring(0, maxlimit);
		}else {
			document.getElementById(counter).innerHTML=charcnt;
		}
	}
</script>
<script type="text/javascript" charset="utf-8" src="static/js/kind/kindeditor.js"></script>
<script type="text/javascript">
    $(function(){
        var t_type = "<!--{echo {$topiclist[topic_type]};}-->";
        t_type = ('undefined' == typeof (t_type) || t_type == '') ? '0' : t_type;
        if(t_type == '1' || t_type == '2'){
            $("textarea").css('width','100%');
            KE.show({
            id : 'maxcharfield',
            resizeMode : 1
            });
        }
    })

</script>
<form action="{$action}" method="post" enctype="multipart/form-data" name="form1" id="form1">
  <table cellspacing="1" cellpadding="4" width="100%" align="center" class="tableborder">
    <tr class="header">
      <td colspan="2">{$title}</td>
    </tr>
    <tr>
      <td width="13%" bgcolor="#F8F8F8">&nbsp;</td>
      <td width="87%" bgcolor="#FFFFFF">&nbsp;</td>
    </tr>
	

    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">发表用户：</td>
      <td bgcolor="#FFFFFF"><a href="javascript:void(0);" data-href="index.php?mod={$topiclist[username]}">{$topiclist[nickname]}</a></td>
    </tr>
    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">标题:</td>
      <td bgcolor="#FFFFFF">
          <input type="type" name="title" value="<!--{echo (strip_tags({$topiclist[title]}));}-->" />
      </td>
    </tr>
    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">简介:</td>
      <td bgcolor="#FFFFFF">
          <input type="type" name="describe" value="<!--{echo (strip_tags({$topiclist[describe]}));}-->" />
      </td>
    </tr>
    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">内容:</td>
      <td bgcolor="#FFFFFF">
	  <textarea name="content" id="maxcharfield" style="width:400px; height:600px;" > <!--{echo (strip_tags({$topiclist[content]}));}--></textarea></td>
    </tr>
    <!--{if $topiclist[topic_type] == '1' || $topiclist[topic_type] == '2'}-->
    <tr>
        <td width="13%" align="center" bgcolor="#F8F8F8">示意图：</td>
        <td bgcolor="#FFFFFF" id="users">
            <input type="file" name="images" id="publisher_files" >（<span class="img_size">大小：640*255，只限一张</span>）
            <div id="viewImgDiv">
                <div class="upimg_img" id="upimg_{$topiclist['tid']}">
                    <input type="hidden" name="topic" value="{$topiclist['tid']}" />
                    <input type="hidden" name="files" value="{$topiclist['poster']}" />
                    <img src="{$topiclist['poster']}" />
                </div>

            </div>
        </td>
    </tr>
    <!--{if $topiclist[topic_type] == '1'}-->
    <tr>
        <td width="13%" align="center" bgcolor="#F8F8F8">开始时间</td>
        <td bgcolor="#FFFFFF">
            <input type="text" id="stime" name="stime" readonly="readonly" class="Wdate" onClick="WdatePicker({dateFmt: 'yyyy-MM-dd  HH:mm'});" value="$topiclist[s_time]">
        </td>
    </tr>
    <tr>
        <td width="13%" align="center" bgcolor="#F8F8F8">结束时间</td>
        <td bgcolor="#FFFFFF">
            <input type="text" id="etime" name="etime" readonly="readonly" class="Wdate" onClick="WdatePicker({dateFmt: 'yyyy-MM-dd  HH:mm'});" value="$topiclist[e_time]">（必须输入，即：超过该时间后，自动下架。）
        </td>
    </tr>
    <!--{/if}-->
    <!--{/if}-->
	<!--{if $attach_list}-->
	<style>.ataachlist li{float:left;margin:0 10px;text-align:center;}</style>
    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">附件:</td>
      <td bgcolor="#FFFFFF"><ul class="ataachlist">
      <!--{loop $attach_list $key $val}-->
	  <li><img src="{$val[attach_img]}" border="0"/><br>{$val[attach_name]}<br>积分：<input type="hidden" name="attach_id[]" value="{$val[id]}"><input type="hidden" name="old_attach_score[]" value="{$val[attach_score]}"><input type="text" name="attach_score[]" size="2" value="{$val[attach_score]}">分<br>
	  <A href="admin.php?mod=topic&code=del_attach&tid=$tid&ids={$val[id]}&verify=$verify"><font color='#D94446'>删除</font></A></li>	
	  <!--{/loop}-->
	  </ul></td>
    </tr>
	<!--{/if}-->
	<!--{if $image_list}-->
    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">图片:</td>
      <td bgcolor="#FFFFFF">
      <!--{loop $image_list $key $val}-->
	  <img src="{$val[img_path]}" border="0"/>
	  <A href="admin.php?mod=topic&code=del_img&tid=$tid&ids={$val[id]}&verify=$verify">删除</A>&nbsp;	
	  <!--{/loop}-->
	  </td>
    </tr>
	<!--{/if}-->
	
	<!--{if $videoid}-->
    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">视频:</td>
      <td bgcolor="#FFFFFF">
	   <div class="feedUservideo">
	  <a onClick="javascript:showFlash('{$videohost}', '{$videolink}', this, '{videoid}');" >
		<div id="play_{$videoid}" class="vP"><img src="static/image/feedvideoplay.gif" style="cursor:pointer;"/></div>
		<img src="{$videoimg}" style="border:none"/>      </a>
	 <A href="admin.php?mod=topic&code=del_video&ids={$videoid}&verify=$verify">删除</A>&nbsp;	  </div>	  </td>
    </tr>
	<!--{/if}-->
   <!--{if $musicid_id}-->
    <tr>
      <td width="13%" align="center" bgcolor="#F8F8F8">音乐:</td>
      <td bgcolor="#FFFFFF">
	 <img src="static/image/music.gif" title="点击播放音乐" border="0" onClick="javascript:showFlash('music', '{$ContentMusicid}', this, '{$musicid_id}');" style="cursor:pointer; border:none;" />
	  <A href="admin.php?mod=topic&code=del_music&ids={$musicid_id}&verify=$verify">删除</A>&nbsp;	  </td>
    </tr>
	<!--{/if}-->
    <tr>
      <td align="center" bgcolor="#F8F8F8">&nbsp;</td>
      <td bgcolor="#FFFFFF">
		<button name="do" value='' type="submit" class="button">提 交</button>
		&nbsp;
		<button class="button" type="button" onclick="javascript:history.back(-1);return false;">返回</button>
		<input name="tid" type="hidden" id="tid" value="{$tid}">
		<input name="imageid" 	type="hidden" 		id="imageid" 	value="{$topiclist[imageid]}" />
		<input name="videoid" 	type="hidden"  		id="videoid" 	value="{$topiclist[videoid]}" />
		<input name="musicid" 	type="hidden"  		id="musicid" 	value="{$topiclist[musicid]}" /></td>
    </tr>
  </table>

</form>
